#include "stm32f10x.h"                  // Device header


uint16_t NUM=0;
void ZDHS()
{
	RCC_APB2PeriphClockCmd (RCC_APB2Periph_GPIOB,ENABLE );
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO,ENABLE );
	
	GPIO_InitTypeDef S1;
	S1.GPIO_Mode =GPIO_Mode_IPU ;
	S1.GPIO_Pin =GPIO_Pin_14 ;
	S1.GPIO_Speed= GPIO_Speed_50MHz ;

	GPIO_Init (GPIOB ,&S1);
	
	GPIO_EXTILineConfig(GPIO_PortSourceGPIOB,GPIO_PinSource14);
	
	EXTI_InitTypeDef S2;
	S2.EXTI_Line =EXTI_Line14;
	S2.EXTI_LineCmd=ENABLE ;
	S2.EXTI_Mode= EXTI_Mode_Interrupt ;
	S2.EXTI_Trigger= EXTI_Trigger_Falling;
	
	EXTI_Init(&S2);
	
	NVIC_InitTypeDef S3;
	S3.NVIC_IRQChannel =  EXTI15_10_IRQn ;
	S3.NVIC_IRQChannelCmd =ENABLE ;
	S3.NVIC_IRQChannelPreemptionPriority =1;
	S3.NVIC_IRQChannelSubPriority=1;
	
	NVIC_PriorityGroupConfig( NVIC_PriorityGroup_2);
	NVIC_Init(&S3);
}


uint16_t NUM_FH(void )
{
	
	return NUM ;
	
}


void  EXTI15_10_IRQHandler (void )
{

	if(EXTI_GetITStatus(EXTI_Line14)==SET )
	{
			if (GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_14) == 0)
	{
		NUM  ++;					//计数值自增一次
	}
	
	
	EXTI_ClearITPendingBit(EXTI_Line14);
	}










}
	